﻿Imports ControladorasAT.SIREOS
Imports ServiciosAT
Imports Utilitarios
Imports System.Data

Partial Class Pages_Default
    Inherits System.Web.UI.Page

    Private Sub consultarPagos()
        Dim oPago As New SireosWSPago.OrdenServicioPago
        oPago.codModalidadPago = ddlbFormaPago.SelectedValue
        oPago.codComprobante = ddlbComprobante.SelectedValue
        oPago.nroComprobante = txbComprobante.Text

        Dim oOrden As New SireosWSPago.OrdenServicio
        oOrden.codigoReferencia = txbOrden.Text
        Dim oSede As New SireosWSPago.Sede
        Dim oCliente As New SireosWSPago.Cliente
        oCliente.nomCliente = txbCliente.Text
        oSede.cliente = oCliente
        oOrden.sede = oSede
        oPago.ordenServicio = oOrden

        Dim oCtPago As New CtPagos
        Dim dt As DataTable = oCtPago.consultarPagos(oPago, txbInicio.Text, txbFin.Text)
        gridPagos.DataSource = dt
        gridPagos.DataBind()

    End Sub

    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Listas.listarTabla(Valores.tabla.ModalidadPago, ddlbFormaPago)
            Listas.listarTabla(Valores.tabla.Comprobante, ddlbComprobante)
        End If
    End Sub

    Protected Sub ibtnBuscar_Click(sender As Object, e As ImageClickEventArgs) Handles ibtnBuscar.Click
        consultarPagos()
    End Sub

    Protected Sub ibtnPagos_Click(sender As Object, e As ImageClickEventArgs) Handles ibtnPagos.Click
        Response.Redirect("CajaPagosRegistro.aspx")
    End Sub

    Protected Sub gridPagos_PageIndexChanging(sender As Object, e As GridViewPageEventArgs) Handles gridPagos.PageIndexChanging
        Dim oCtPago As New CtPagos
        gridPagos.PageIndex = e.NewPageIndex
    End Sub

End Class
